<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
	<title>DHTML Tree samples. dhtmlXTree - Moving items</title>
</head>
<style>
	body {font-size:12px}
	.{font-family:arial;font-size:12px}
	h1 {cursor:hand;font-size:16px;margin-left:10px;line-height:10px}
	xmp {color:green;font-size:12px;margin:0px;font-family:courier;background-color:#e6e6fa;padding:2px}
</style>
<body>
	<h1>Moving items</h1>
	<link rel="STYLESHEET" type="text/css" href="../css/dhtmlXTree.css">
	<script  src="../js/dhtmlXCommon.js"></script>
	<script  src="../js/dhtmlXTree.js"></script>		
	<table>
		<tr>
			<td>
				<div id="treeboxbox_tree" style="width:250; height:218;background-color:#f5f5f5;border :1px solid Silver;; overflow:auto;"/>
			</td>
            <td>
				<div id="treeboxbox_tree2" style="width:250; height:218;background-color:#f5f5f5;border :1px solid Silver;; overflow:auto;"/>
			</td>
			<td rowspan="2" style="padding-left:25" valign="top">
            <div>Move from left tree to right tree</div>
            </div>
            Move selected<a href="javascript:void(0)" onclick="tree.moveItem(tree.getSelectedItemId(),'item_child',tree2.getSelectedItemId(),tree2)"> to child </a></select>
            </div>
            <div>
            Move selected <a href="javascript:void(0)" onclick="tree.moveItem(tree.getSelectedItemId(),'item_sibling',tree2.getSelectedItemId(),tree2)"> to sibling </a></select>
            </div>
            <br/>
            <div>Move from right tree to left tree</div>
            </div>
            Move selected<a href="javascript:void(0)" onclick="tree2.moveItem(tree2.getSelectedItemId(),'item_child',tree.getSelectedItemId(),tree)"> to child </a></select>
            </div>
            <div>
            Move selected <a href="javascript:void(0)" onclick="tree2.moveItem(tree2.getSelectedItemId(),'item_sibling',tree.getSelectedItemId(),tree)"> to sibling </a></select>
            </div>

            <br/>
            <div>Move inside left tree</div>
             <div>
			Move selected <a href="javascript:void(0)" onclick="tree.moveItem(tree.getSelectedItemId(),'up')"> Up </a> | <a href="javascript:void(0)" onclick="tree.moveItem(tree.getSelectedItemId(),'down')">Down</a> | <a href="javascript:void(0)" onclick="tree.moveItem(tree.getSelectedItemId(),'left')"> Left</a>
            <div>
             <div>
			Move selected <a href="javascript:void(0)" onclick="tree.moveItem(tree.getSelectedItemId(),'up_strict')"> Up on level </a> | <a href="javascript:void(0)" onclick="tree.moveItem(tree.getSelectedItemId(),'down_strict')">Down on level</a>
            <div>
            </div>
            Move selected <a href="javascript:void(0)" onclick="tree.moveItem(tree.getSelectedItemId(),'item_child',this.nextSibling.value)"> to child of </a><select><option value="books">Books</option><option value="sport">Sport</option><option value="magazines">Magazines</option></select>
            </div>
            <div>
            Move selected <a href="javascript:void(0)" onclick="tree.moveItem(tree.getSelectedItemId(),'item_sibling',this.nextSibling.value)"> to sibling of </a><select><option value="books">Books</option><option value="sport">Sport</option><option value="magazines">Magazines</option></select>
            </div>
            </td>
		</tr>
		<tr>
			<td></td>
		</tr>
	</table>
<hr>
<XMP>
<div id="treeboxbox_tree" style="width:200;height:200"></div>
<script>
	tree=new dhtmlXTreeObject("treeboxbox_tree","100%","100%",0);
		tree.setImagePath("../imgs/");
		tree.loadXML("tree.xml")
		
		...
        //moving item inside tree
		tree.moveItem(itemId,"up");
		tree.moveItem(itemId,"down");
		tree.moveItem(itemId,"left");
		tree.moveItem(itemId,"item_child",targetId);
		tree.moveItem(itemId,"item_sibling",targetId);
        ...
        //moving items between trees
		sourceTree.moveItem(itemId,"item_child",targetId,targetTree);
		sourceTree.moveItem(itemId,"item_sibling",targetId,targetTree);

</script>
</XMP>
	<script>
			tree=new dhtmlXTreeObject("treeboxbox_tree","100%","100%",0);
			tree.setImagePath("../imgs/");
			tree.enableSmartXMLParsing(true);
			tree.loadXML("tree.xml")


			tree2=new dhtmlXTreeObject("treeboxbox_tree2","100%","100%",0);
			tree2.setImagePath("../imgs/");
			tree2.enableSmartXMLParsing(true);
			tree2.loadXML("tree.xml")

	</script>
<br><br>

</body>
</html>
